Repository navigation
feat(fleet): multi-role serve list — one daemon, several roles (#6264) - #8394
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2365578df1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
🤖 Agent note · parked on CI (task 11452, lane code-f) PR #8394 implements #6264 (design #5698 option (i)): the multi-role serve list, plus the precondition refactor making both brokers' run() return setup failures instead of exiting the process. Verified on the laptop: cargo test -p fleet-queue -p fleet all pass (4 new serve-list unit tests), and a live demo ran Parked as a CI wait: checks are pending at head 2365578 with no failures. Resume: when PR #8394 checks complete, merge if green — that lands #6264's acceptance and closes issue #6264 (design record #5698 stays open per its own terms until Drew closes it). |
… exiting Precondition for multi-role serve (design #5698 step 2, impl #6264): queue_broker::run and secrets_broker::run called std::process::exit on setup failures (home resolution, token files, Turso token/schema, bind). Every such site now returns the same exit code (2 or 3) to the caller. The standalone bins already exit with the returned code, so single-role behavior is unchanged; a supervisor hosting several roles in one process now sees a role setup failure as that role returning its code.
Implements design #5698 option (i), approved by Drew 2026-11-05: fleet serve <role> [<role> ...] runs two or more roles in one process, each existing blocking serve loop on its own thread under a small supervisor. All roles are capability-checked before anything binds (an unavailable role stubs the whole list at exit 69 — no partial starts); a role thread that returns or panics is fatal, exiting with the role code and naming the role, so the external supervisor restarts the unit. The list can express the complete current serve set (queue-broker, secrets-broker, search, proxy) — the equivalent-of-all criterion — pinned by serve_set_covers_every_serve_token. Single-role invocations are untouched: a role plus its own tail (search flags, --help) is not a list and keeps the existing per-role paths; bare fleet serve stays a usage error; duplicate roles and stray tokens in a list are usage errors naming the token.
…bounded startup retry for the Turso token P1: serve list runs the proxy via fleet_proxy::serve::run_cohosted (idle-exit disabled); standalone run() keeps the auto-spawned lifetime. P2: queue_broker resolves the Turso token via resolve_with_startup_retry (250ms backoff, 30s budget) so a cold co-hosted secrets-broker no longer races it into exit 3; two unit tests pin the retry contract.
2365578 to
ebb9019
Compare
…e-all # Conflicts: # pkgs/fleet/crates/fleet-queue/src/secrets_broker.rs
Summary
Implements #6264: the approved serve-all design from #5698 (option (i), the multicall list, approved by Drew 2026-11-05).
fleet serve <role> [<role> ...]with two or more distinct role tokens runs all of them in ONE process — each role's existing blocking serve loop on its own thread, supervised from main. Every role is capability-checked before anything binds (an unavailable role stubs the whole list at exit 69; no partial starts). A role thread that returns or panics is fatal: the process exits with the role's code (1 if it reported success) and names the role, so the external supervisor (systemd) restarts the unit — no in-process restarter, per the design.fleet servestays a usage error; duplicate roles and stray tokens inside a list are usage errors naming the token (the stray-arg class the design called out).allsugar and --with-proxy remain deferred per the design (proxy IS a list member here becausefleet serve proxyis already a serve-domain role in the current build, and equivalent-of-all requires the full set to be expressible).Evidence
fleet serve queue-broker secrets-brokerprinted "starting 2 roles in one process", both brokers listened (127.0.0.1:14801 / :14800), secrets-broker /health answered ok, queue-broker /health answered its unauthorized gate, and both UDS dual-binds degraded to TCP-only against the live brokers' sockets without disturbing them.fleet serveusage error;fleet serve queue-broker queue-brokerduplicate-role error; a stray token in a list is named in the error.Merge Danger
Door: two-way. Blast radius: fleet serve dispatch and the two brokers' setup-failure paths. Single-role serve — what every live unit runs — keeps identical behavior and exit codes; the multi-role path only activates on the new list grammar.